﻿using System.Collections.Generic;

namespace LBSoft.Common.DotNetExt
{
    public static class ExtStringArray
    {
        /// <summary>
        /// 将数组转换为List
        /// </summary>
        /// <param name="source"></param>
        /// <param name="needTrim"></param>
        /// <returns></returns>
        public static List<string> ToList(this string[] source, bool needTrim)
        {
            List<string> list = new List<string>();
            foreach (string s in source)
            {
                list.Add(needTrim ? s.Trim() : s);
            }
            return list;
        }
    }
}
